mtrtechfandomcom-20200214-history
Connect to Raspberry Pi Using SSH (like PuTTY)
I already showed you how to use the Raspberry Pi "headless" using TightVNC. You can review that here. However, most of the time, I only need to use the command line interface for the Pi. In that case, you can still be "headless" by using a SSH connection. The only requirements for this are that you # Setup the Pi on your local network. (Described here.) # Enable SSH connections on the Raspberry Pi Enable SSH Connection on the Raspberry Pi You can enable SSH connections using by issuing the following command in the terminal: raspi-config #8 Advanced Options (then hit Enter) #A4 SSH (then hit enter) #Select (then hit enter) You should then see a confirmation page that says "SSH server enabled". No reboot is required. You're now ready to connect to the Pi from another computer using an SSH client. Connecting to Raspberry Pi Using PuTTY To connect using PuTTY, you first must enable SSH connections through raspi-config, as described above.) You can now use an SSH program like PuTTY on another computer to talk to your Pi. You can download PuTTY here. Note that what you download is the program itself (the executable), not an installer, so save it wherever you'd like and just run it! PuTTY is a very common tool for establishing all types of connections, including serial and SSH. To establish an SSH connection with the Raspberry Pi, all you need to know if its IP address (or host name). To get the Pi's hostname, send the command ifconfig Your IP address should be listed under "wlan0" section beside "inet addr" (assuming you're using a wireless connection; it's under "eth0" if you're using a wired connection). To get the Pi's hostname, send the command hostname On your other computer, open PuTTY. Under the "Specify the destination you want to connect to" section, type in the IP address (or hostname) of the Raspberry Pi under "Host Name (or IP address)". Leave the port as the default value (22). Under "Connection type", choose the "SSH" radio button. NOTE: It's a good idea to use the hostname, instead of the IP address if you're using DHCP (which is default for most routers). When using DHCP, your router can dynamically change your IP address. However, your hostname will always stay the same. If you'd like, you can also save this connection. To do this, under the "Load, save, or delete a stored session" section, name the connection anything you'd like under "Saved Sessions" and click "Save". Your new connection will now appear in the list of saved sessions. Now, anytime you run PuTTY, you can click your named session in the list and click "Load". Here's what PuTTY should look like: Once your settings are correct, click "Open" at the bottom of the interface. If successful, a new window will pop up asking you to login: Login with your Pi's user name and password. Once you're logged in, you'll be taken right to your users terminal prompt: That's it! You're in! Category:Raspberry Pi Category:Remote Category:Headless Category:PuTTY Category:SSH Category:Raspi-config